import { service as request } from '@/utils/request'

/**
 * 17.6 供应商 根据名字 分页查
 * @param {*} data 
 * @returns 
 */
export function getList (data) {
  return request({
    url: `/hawk/provider/search/${data.page.current}/${data.page.size}`,
    method: 'get',
    params: {
      name: data.query.name
    }
  })
}


/**
 * 分页查询公司
 * @param {*} data 
 * @returns 
 */
 export function isNameHave (name) {
  return request({
    url: `/hawk/provider/exists`,
    method: 'get',
    params: {
      name: name
    }
  })
}


export function searchList (data) {
  return request({
    url: `/assets/dictionaries/supplier/page/${JSON.stringify(data)}`,
    method: 'get'
  })
}
/**
 * 
 * @param {*} data 
 * @returns 
 */
export function doAdd (data) {
  return request({
    url: '/hawk/provider/save',
    method: 'post',
    data
  })
}
/**
 * 
 * @param {*} data 
 * @returns 
 */
export function doEdit (data) {
  return request({
    url: '/hawk/provider/update',
    method: 'put',
    data
  })
}

export function doDelete (ids) {
  return request({
    url: `/hawk/provider/del`,
    method: 'delete',
    data: ids
  })
}
export function getOne (id) {
  return request({
    url: `/assets/dictionaries/supplier/${id}`,
    method: 'get'
  })
}
/**
 * 获得所有的供应商
 * @returns 
 */
export function getAll () {
  return request({
    url: `/hawk/provider/get/all`,
    method: 'get'
  })
}